package com.portal.framework.interceptor;

import org.springframework.beans.factory.InitializingBean;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
import com.portal.framework.dao.ParameterCatch;
import com.portal.system.parameter.ParameterService;




/**
 * Project: spmanage
 * 
 * Remark: 验证用户是否登录
 * 
 * Author: tanghong
 * 
 * Create Date: 2010-4-17
 */
public class AuthorityInterceptor implements Interceptor, InitializingBean {
	private static final long serialVersionUID = 2590058205697988476L;

	private ParameterService parameterService;
//	private DepartService departService;
	
//	private SysWebService sysWebService;
	public static long getSerialVersionUID() {
		return serialVersionUID;
	}

	public void afterPropertiesSet() throws Exception {

	}
	
	public void destroy() {

	}

	public void init() {
		//菜单
		ParameterCatch.setParameterService(parameterService);
		ParameterCatch.inne();
	}


	@SuppressWarnings("unchecked")
	public String intercept(ActionInvocation invocation) throws Exception {
		return invocation.invoke();
//		
//		//检查Session中是否存在user
//        Map session = invocation.getInvocationContext().getSession();
//        //获取session中的所有的属性
//        CustomerDTO customerDTO = (CustomerDTO)session.get("customer");
//        if (customerDTO!=null ) {
//        	String s= invocation.getInvocationContext().getName();
//    		if(s!=null&&s.substring(0,2).equals("do")){
////    			Debug.logDebug("日志信息 IP:"+ServletActionContext.getRequest().getRemoteAddr()+", 管理员:"+customerDTO.getCustomerName()+", 类名："+invocation.getAction().toString()+", 操作："+s,"拦截器");
//    		}
//        	//存在的情况下进行后续操作。
//        	return invocation.invoke();
//        } else {
//        	//否则终止后续操作，返回LOGIN
//		    return Constants.PAGE_LOGIN;
//        }
    }
//
//	public SysWebService getSysWebService() {
//		return sysWebService;
//	}
//
//	public void setSysWebService(SysWebService sysWebService) {
//		this.sysWebService = sysWebService;
//	}

	public ParameterService getParameterService() {
		return parameterService;
	}

	public void setParameterService(ParameterService parameterService) {
		this.parameterService = parameterService;
	}

//	public DepartPrivilegeService getDepartPrivilegeService() {
//		return departPrivilegeService;
//	}
//
//	public void setDepartPrivilegeService(
//			DepartPrivilegeService departPrivilegeService) {
//		this.departPrivilegeService = departPrivilegeService;
//	}
//
//	public DepartService getDepartService() {
//		return departService;
//	}
//
//	public void setDepartService(DepartService departService) {
//		this.departService = departService;
//	}
	
}
